package mapper;

import DO.WorkClassDO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface WorkClassMapper {
    // 班级添加
    @Insert("insert into work_class (work_id, class_id, start_time, end_time, create_time) VALUES (#{workId},#{classId},#{startTime},#{endTime},#{createTime})")
    void save(WorkClassDO workClassDO);

    // 根据班级id获取全部信息
    @Select("select * from work_class where class_id = #{classId} ORDER BY start_time")
    List<WorkClassDO> getByClassId(Integer classId);

    // 根据班级id获取结束时间
    @Select("select end_time from work_class where class_id = #{classId} and work_id = #{workId}")
    LocalDateTime getEndTimeByClassId(Integer classId,Integer workId);

    @Select("select work_id from work_class where class_id = #{classId}")
    List<Integer> getWakeIdByClassId(Integer classId);
}
